<!--
 * @Date: 2023-03-10 09:40:19
 * @LastEditors: wkl
 * @LastEditTime: 2023-04-20 09:02:00
 * @FilePath: /demo/demo5.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <script src="https://cdnjs.com/libraries/pdf.js" type="module"></script> -->
    <script src="https://cdn.jsdelivr.net/npm/jspdf/dist/jspdf.umd.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vxe-table-plugin-export-pdf/fonts/source-han-sans-normal.js"></script>
    <script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
    <style>
        #demo {
            /* font-family: 'SourceHanSans-Normal' */
        }
    </style>
</head>

<body>
    <button onclick="down()">下载</button>
    <div style="font-family:SourceHanSans-Normal;" id="demo">deosbdjcbsdjbsjhdcb是开</div>
    <div>
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1"
            width="32" height="32.000244140625" viewBox="0 0 32 32.000244140625">
            <g style="mix-blend-mode:passthrough">
                <g>
                    <g style="mix-blend-mode:passthrough">
                        <rect x="0" y="0" width="32.00019836425781" height="32.00019836425781" rx="16.000099182128906"
                            fill="#13C2C2" fill-opacity="1" />
                        <g>
                            <g style="mix-blend-mode:passthrough">
                                <g>
                                    <g style="mix-blend-mode:passthrough">
                                        <g>
                                            <path
                                                d="M19,23.3636L19,8.63636L9.00001,8.63636L9.00001,23.3636L19,23.3636ZM21,10.27271L24.0001,10.27271C24.5522,10.27271,25,10.63903,25,11.090900000000001L25,24.1817C25,24.6336,24.5522,25,24.0001,25L8.07693,25C7.48216,25,7,24.597,7,24.1L7,7.900001C7,7.402943,7.48216,7,8.07693,7L19.923099999999998,7C20.5178,7,21,7.402943,21,7.900001L21,10.27271ZM21,11.90908L21,23.3636L22.9999,23.3636L22.9999,11.90908L21,11.90908ZM10.99999,11.90908L13,11.90908L13,13.54544L10.99999,13.54544L10.99999,11.90908ZM15.00001,11.90908L16.99999,11.90908L16.99999,13.54544L15.00001,13.54544L15.00001,11.90908ZM10.99999,15.18179L13,15.18179L13,16.81815L10.99999,16.81815L10.99999,15.18179ZM15.00001,15.18179L16.99999,15.18179L16.99999,16.81815L15.00001,16.81815L15.00001,15.18179ZM12.49999,20.090899999999998L15.49999,20.090899999999998C15.77615,20.090899999999998,16,20.274,16,20.4999L16,23.3636L12.00001,23.3636L12.00001,20.4999C12.00001,20.274,12.22386,20.090899999999998,12.49999,20.090899999999998Z"
                                                fill="#FFFFFF" fill-opacity="1" />
                                        </g>
                                    </g>
                                </g>
                            </g>
                        </g>
                    </g>
                </g>
            </g>
        </svg>
    </div>
    dfc
</body>
<script>
    function down() {
        var doc = new jspdf.jsPDF();
        let shareContent = document.getElementById('demo')
        // 添加并设置字体
        doc.addFont('SourceHanSans-Normal.ttf', 'SourceHanSans-Normal', 'normal');
        doc.setFont('SourceHanSans-Normal');
        // doc.text(20, 20, '简体中文、繁體体中文、English、ジャパン、한국어');
        // doc.save('my.pdf');

        doc.html(shareContent, {
            callback: (docs) => {

                // doc.setFont('SourceHanSansHC
                // docs.addFont('SourceHanSans-Normal.ttf', 'SourceHanSans-Normal', 'normal')
                // docs.setFont('SourceHanSans-Normal')
                docs.save(`${this.fileName}.pdf`)
            },
            x: 10,
            y: 20
        })
    }


    // html2pdf().from(doc).save();
</script>

</html>